<% content_for :action_nav do %>
  <div id="page-nav">
    <ul id="act-nav" class="clear">
      <li><%= link_to _("New template"), url_for_theme(:controller => 'design') %></li>
      <li><%= link_to _("Manage themes"), :controller => 'themes' %></li>
    <% if @theme.templates.custom.include?(@tmpl.basename.to_s) -%>
      <li><%= link_to _('Delete this file'), url_for_theme(:action => 'remove', :filename => @tmpl.basename), 
                :confirm => _("Are you sure you want to delete %{basename}?\nThis action can't be undone!") % {:basename => @tmpl.basename} %></li>
    <% end -%>
    </ul>
  </div>
<% end %>

<div id="template-container">
<%= form_remote_tag :url => url_for_theme(:action => 'update', :filename => params[:filename]), :html => { :id => 'template-form' } %>
<%= render :partial => 'admin/design/form', :locals => { 
  :attachment => @tmpl,
  :title      => @tmpl.basename.to_s,
  :hint       => _('You can use HTML and Liquid in your template.'),
  :labels     => { :data     => %(Edit the source code for your <em class="highlight">#{@tmpl.basename}</em> template),
                   :filename => 'Title of your template' }
 } %>
<p class="btns">
  <%= submit_tag _("Update %{basename}") % {:basename => @tmpl.basename} %> or
  <%= link_to _("cancel"), :controller => "design" %>
</p>
</form>
</div>

<%= render :partial => 'admin/design/sidebar' %>